package com.week2.day05;

public class Dog {
    public Dog() {
    }

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object anotherObj) {
        if (this == anotherObj) {
            return true;
        }
        if (anotherObj instanceof Dog) {
            Dog anotherDog = (Dog) anotherObj;
            if (this.name.equals(anotherDog.getName()) && this.age == anotherDog.getAge()) {
                return true;
            }
        }
        return false;
    }
}
